package net.feling.mcloud.connection;

import android.app.Application;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import net.feling.mcloud.utils.Config;

public class BatteryBroadcastReceiver extends BroadcastReceiver {
    private static final String BATTERY_LEVEL = "level";

    @Override
    public void onReceive(Context context, Intent intent) {
        int level = intent.getIntExtra(BATTERY_LEVEL, 0);
        Config config = (Config) context.getApplicationContext();
        config.setBatteryLevel(level);
    }
}
